Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-31462] GitHub Enterprise Servers validation #12

Merged
merged 4 commits into from
Dec 4, 2015

Conversation

recena
Copy link
Contributor

@recena recena commented Nov 23, 2015

JENKINS-31462

Please, consider the comments and reviews in this PR #10 (original)

downstream jenkinsci/github-api-plugin#6, downstream hub4j/github-api#232

Result

jenkins-31462

@reviewbybees, specially @jglick

@ghost
Copy link

ghost commented Nov 23, 2015

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

@oleg-nenashev
Copy link
Member

🐝 , but the PR is blocked by github-api

@recena
Copy link
Contributor Author

recena commented Nov 25, 2015

@oleg-nenashev Thanks, I'm waiting for hub4j/github-api#232

@recena
Copy link
Contributor Author

recena commented Dec 3, 2015

@oleg-nenashev The dependency was upgraded.

@@ -36,10 +36,11 @@
<artifactId>git</artifactId>
<version>2.3</version>
</dependency>
<!-- TODO: Update when org.jenkins-ci.plugins:github-api is released -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's no more a TODO

@recena recena force-pushed the master branch 2 times, most recently from cb88226 to bf55ed0 Compare December 3, 2015 11:27
@amuniz
Copy link
Member

amuniz commented Dec 3, 2015

🐝

@oleg-nenashev
Copy link
Member

Occasionally commented in the PR. 🐛 for the loss of the error info in the Web UI validation output

@recena
Copy link
Contributor Author

recena commented Dec 3, 2015

@oleg-nenashev

  1. I've decided to use API URL because GitHub API Documentation use URL instead of URI
  2. I'm showing a helpful message to the use, enough to know that something is wrong

@oleg-nenashev
Copy link
Member

I'm removing the bug according to my discussion with @recena
GitHub.connectToEnterpriseAnonymously(api.toString()) may throw IOException (e.g. if GitHub server is unavailable), so I still don't think the current validation is good enough to put a bee.

@oleg-nenashev
Copy link
Member

I'm showing a helpful message to the use, enough to know that something is wrong

The message is definitely helpful, but it does not cover all possible cases. Examples of other causes, which may lead to the IOException

  • API URL is valid, but GitHub server is unavailable or shut down
  • API URL is valid, but GitHub instance rejects anonymous connection attempts

@recena
Copy link
Contributor Author

recena commented Dec 3, 2015

@oleg-nenashev

API URL is valid, but GitHub server is unavailable or shut down

It should be considered in the library, not here.

API URL is valid, but GitHub instance rejects anonymous connection attempts

If you mean GitHub Enterprise in private mode, it is considered.

@oleg-nenashev
Copy link
Member

But the current code will show "This does not look like a GitHub Enterprise API URL" in both cases, won't it? What prevents you from displaying the exception message in the validation output?

@recena
Copy link
Contributor Author

recena commented Dec 3, 2015

@oleg-nenashev I hope you agree with me on both cases are exceptional. The current PR handles:

  1. Empty URL
  2. Invalid URL (syntax)
  3. A valid URL that does not correspond with a GitHub API URL

By the way, I had to modify the code after your first 🐝 because @kohsuke modified my initial proposal. I was confident with the first approach.

@recena
Copy link
Contributor Author

recena commented Dec 3, 2015

@oleg-nenashev Trying to improve the PR I've found an example about why don't use e.getMessage() in validation messages when everything is throw in IOException:

Dec 03, 2015 7:09:14 PM org.jenkinsci.plugins.github_branch_source.Endpoint$DesciptorImpl doCheckApiUri
WARNING: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

Imagine the warning message in the UI.

@recena
Copy link
Contributor Author

recena commented Dec 3, 2015

@jglick If you agree, I'd like to merge this PR. IMO is ready to merge.

@oleg-nenashev
Copy link
Member

I'm not convinced, but feel free to go forward if you feel strong

@recena
Copy link
Contributor Author

recena commented Dec 3, 2015

@oleg-nenashev I totally disagree with show to the user technical information like WARNING: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null').

Additionally, all cases that you mentioned before should be handle in the library. I only needed a true or false but @kohsuke changed the method.

@recena
Copy link
Contributor Author

recena commented Dec 3, 2015

@oleg-nenashev I agree with show to the user detailed information if he can do anything with this information. Only in these cases.

GitHub github = GitHub.connectToEnterpriseAnonymously(api.toString());
github.checkApiUrlValidity();
return FormValidation.ok();
} catch (MalformedURLException mue) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use catch (MalformedURLException | JsonParseException e) and avoid the duplicated message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know but we are not using this feature of Java SE 7 in this plugin.

@amuniz
Copy link
Member

amuniz commented Dec 4, 2015

🐝

1 similar comment
@jglick
Copy link
Member

jglick commented Dec 4, 2015

🐝

@recena
Copy link
Contributor Author

recena commented Dec 4, 2015

@reviewbybees done

@ghost
Copy link

ghost commented Dec 4, 2015

This pull request has completed our internal processes and we now respectfully request the maintainers of this repository to consider our proposal contained within this pull request for merging.

recena added a commit that referenced this pull request Dec 4, 2015
[JENKINS-31462] GitHub Enterprise Servers validation
@recena recena merged commit 384e7a9 into jenkinsci:master Dec 4, 2015
dubrsl pushed a commit to dubrsl/github-branch-source-plugin that referenced this pull request Oct 17, 2020
…ycrawl.tools-checkstyle-8.18

Bump checkstyle from 8.17 to 8.18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants